package com.charles.core;


import cn.hutool.extra.spring.SpringUtil;
import com.charles.core.generator.IdGeneratorFactory;
import com.charles.core.generator.UIdGenerator;

/**
 * @author du_imba
 */
public class AppIdClient {

    private static IdGeneratorFactory factory = SpringUtil.getBean(IdGeneratorFactory.class);

    private AppIdClient() {
    }

    public static Long nextId(String bizType) {
        if (bizType == null) {
            throw new IllegalArgumentException("type is null");
        }
        UIdGenerator idGenerator = factory.getIdGenerator(bizType);
        return idGenerator.nextId();
    }

}
